package com.hspedu.map_;

import java.util.Properties;

/**
 * @author LiuJinTao
 * @className Properties_
 * @date 2024/06/12 17:32
 * @description TODO
 */
@SuppressWarnings({"all"})
public class Properties_ {
    public static void main(String[] args) {
        // 增加
        // 1.Properties() 继承 HashTable
        // 2.可以通过 k-v 存放数据，当然 key 和 value 不能为 null
        Properties properties = new Properties();
        properties.put("join", 100);// k-v
//        properties.put(null, 100);// 抛出空指针异常
//        properties.put("join", null);// 抛出空指针异常
        properties.put("lucy", 100);
        properties.put("lic", 100);
        properties.put("lic", 88);
        System.out.println("propertise=" + properties);

        // 通过 key 获取对应的值
        System.out.println(properties.get("lic"));//88

        // 删除
        properties.remove("lic");
        System.out.println("propertise=" + properties);

        // 修改
        properties.put("join", "约翰");
        System.out.println("propertise=" + properties);

    }
}
